import {handleActions} from 'redux-actions';
import * as commonTypes from '../../actions/type/CommonTypes';

const defaultStatus = {
    isRefreshing: false,
    isLoading: false
};

export default handleActions({
    [commonTypes.LIST_REFRESH_DOING]: (state, action) => {
        return {
            ...state,
            isRefreshing: true,
            isLoading: false
        }
    },
    [commonTypes.LIST_REFRESH_DONE]: (state, action) => {
        return {
            ...state,
            isRefreshing: false,
            isLoading: false
        }
    },
    [commonTypes.LIST_LOAD_DOING]: (state, action) => {
        return {
            ...state,
            isLoading: true,
            isRefreshing: false
        }
    },
    [commonTypes.LIST_REFRESH_DONE]: (state, action) => {
        return {
            ...state,
            isLoading: false,
            isRefreshing: false
        }
    }
}, defaultStatus);